package com.yoshino.adapter.objectdapter;

/**
 * 适配器类
 * @author yoshino
 **/
public class VoltageAdapter implements IVoltage5V {
    // 关联关系 - 聚合
    private Voltage220V voltage220V;

    public VoltageAdapter(Voltage220V voltage220V) {
        this.voltage220V = voltage220V;
    }

    @Override
    public int output5V() {
        int dst = 0;
        if (null != voltage220V) {
            // 获取到 220V 电压
            int srcV = voltage220V.output220v();
            System.out.println("使用对象适配器");
            dst = srcV / 44;
        }
        return dst;
    }
}
